package dao.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * ReceivingAddress entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "receiving_address", catalog = "onlinemall")
public class ReceivingAddress implements java.io.Serializable {

	// Fields

	private Integer addressId;
	private MemberInfo memberInfo;
	private String addressName;
	private String receiverName;
	private String receiverTel;
	private String receiverPhone;
	private String postcode;
	private Set<Order> orders = new HashSet<Order>(0);

	// Constructors

	/** default constructor */
	public ReceivingAddress() {
	}

	/** minimal constructor */
	public ReceivingAddress(Integer addressId, MemberInfo memberInfo,
			String addressName, String receiverName, String postcode) {
		this.addressId = addressId;
		this.memberInfo = memberInfo;
		this.addressName = addressName;
		this.receiverName = receiverName;
		this.postcode = postcode;
	}

	/** full constructor */
	public ReceivingAddress(Integer addressId, MemberInfo memberInfo,
			String addressName, String receiverName, String receiverTel,
			String receiverPhone, String postcode, Set<Order> orders) {
		this.addressId = addressId;
		this.memberInfo = memberInfo;
		this.addressName = addressName;
		this.receiverName = receiverName;
		this.receiverTel = receiverTel;
		this.receiverPhone = receiverPhone;
		this.postcode = postcode;
		this.orders = orders;
	}

	// Property accessors
	@Id
	@Column(name = "address_id", unique = true, nullable = false)
	public Integer getAddressId() {
		return this.addressId;
	}

	public void setAddressId(Integer addressId) {
		this.addressId = addressId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "member_id", nullable = false)
	public MemberInfo getMemberInfo() {
		return this.memberInfo;
	}

	public void setMemberInfo(MemberInfo memberInfo) {
		this.memberInfo = memberInfo;
	}

	@Column(name = "address_name", nullable = false, length = 200)
	public String getAddressName() {
		return this.addressName;
	}

	public void setAddressName(String addressName) {
		this.addressName = addressName;
	}

	@Column(name = "receiver_name", nullable = false, length = 30)
	public String getReceiverName() {
		return this.receiverName;
	}

	public void setReceiverName(String receiverName) {
		this.receiverName = receiverName;
	}

	@Column(name = "receiver_tel", length = 13)
	public String getReceiverTel() {
		return this.receiverTel;
	}

	public void setReceiverTel(String receiverTel) {
		this.receiverTel = receiverTel;
	}

	@Column(name = "receiver_phone", length = 13)
	public String getReceiverPhone() {
		return this.receiverPhone;
	}

	public void setReceiverPhone(String receiverPhone) {
		this.receiverPhone = receiverPhone;
	}

	@Column(name = "postcode", nullable = false, length = 6)
	public String getPostcode() {
		return this.postcode;
	}

	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "receivingAddress")
	public Set<Order> getOrders() {
		return this.orders;
	}

	public void setOrders(Set<Order> orders) {
		this.orders = orders;
	}

}